import request from '@/utils/request'

/** 登录接口 */
export function loginByUsername(phone, password, loginType) {
  const data = {
    phone,
    password,
    loginType
  }
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

/** 绑定手机号和微信 */
export function binding_phone_wechat(data) {
  return request({
    url: '/auth/binding_phone_wechat',
    method: 'post',
    data
  })
}

/** 修改密码 */
export function updatePassword(data) {
  return request({
    url: '/auth/updatePassword',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/admin/auth/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/admin/auth/info',
    method: 'get',
    params: { token }
  })
}

export function getKaptcha() {
  return request({
    url: '/admin/auth/kaptcha',
    method: 'get'
  })
}
